const Router = require('koa-router')

const config = require('../config')
const controller = require('../controller')
const router = new Router({
    // prefix: config.APP.ROOT_PATH
})
router.get('/index', async (ctx, next) => {
    await ctx.render('index', {
        title: '首页'
    })
})
router.get('/resgister', async (ctx, next) => {
    await ctx.render('resgister', {
        title: '注册'
    })
})
router.get('/login', async (ctx, next) => {
    await ctx.render('login', {
        title: '登录'
    })
})
router.get('/form', async (ctx, next) => {
    await ctx.render('form', {
        title: '表单'
    })
})
router.get('/404', async (ctx, next) => {
    await ctx.render('404', {
        title: '404'
    })
})
router.get('/calendar', async (ctx, next) => {
    await ctx.render('calendar', {
        title: '日历'
    })
})
router.get('/tables', async (ctx, next) => {
    await ctx.render('tables', {
        title: '表格'
    })
})
router.get('/chart', async (ctx, next) => {
    await ctx.render('chart', {
        title: '注册'
    })
})
router.get('/sign-up', async (ctx, next) => {
    await ctx.render('sign-up', {
        title: '表格'
    })
})
router.get('/table-list', async (ctx, next) => {
    await ctx.render('table-list', {
        title: '文字列表'
    })
})
router.get('/table-list-img', async (ctx, next) => {
    await ctx.render('table-list-img', {
        title: '图文列表'
    })
})



router.get('/api/article',controller.article.getArts)
router.post('/api/login', controller.auth.login)
router.post('/api/logout', controller.auth.logout)
router.post('/api/resgister', controller.auth.resgister)
router.get('/api/getUserInfo', controller.authInfo.getUserInfo)
router.post('/api/setUserInfo', controller.authInfo.setUserInfo)
router.post('/api/updateInfo', controller.authInfo.updateInfo)
router.post('/api/addShop',controller.shop.addShop)
router.get('/api/getShops',controller.shop.getShops)
router.post('/api/deleteShop',controller.shop.deleteShop)
router.get('/api/shopParticuler',controller.shop.shopParticuler)
router.post('/api/updateShop',controller.shop.updateShop)

module.exports = router
